package com.leessy.r229.server.http.databean


/**
 * @author : Created by liucheng. on 2021/01/06
 * @description : -
 */

open class ResponesBean {
    /*Status	string	服务器处理结果，100为成功，101为失败。
    Msg	string	Status为101时，设备将此字段内容显示到设备显示屏上（字段长度为5个汉字以内）*/
    var code = 0
    var msg: String? = null

    fun isSuccess(): Boolean {
        return code == 100
    }

}

class HeartBeatBean : ResponesBean() {
    var time: String? = null
    var action: Int = 0
    var text: String? = null
    var tasks: List<TaskData>? = null
    var config: ConfigData? = null

    override fun toString(): String {
        return "HeartBeatBean(time=$time, action=$action, text=$text, tasks=$tasks, config=$config)"
    }

}

class ConfigData {
    var installationCtrl = false  //开启app安装控制，开启后仅列表指定app可以安装
    var installationList: String? = null //允许安装列表
        get() {
            if (null == field) return ""
            return field
        }
    var appEnableCtrl = false  //开启app禁用控制，开启后仅列表指定app可以使用，不会禁止安装或卸载
    var appEnableList: String? = null //允许使用的app列表
        get() {
            if (null == field) return ""
            return field
        }

    var deviceName: String? = null  //配置设备名称
        get() {
            if (null == field) return ""
            return field
        }
    var deviceExpire = false  //设备预警开启
    var deviceExpireMsg: String? = null  //设备预警 显示内容 msg
    var deviceLockMsg: String? = null  //设备预警 锁定 msg
        get() {
            if (null == field) return ""
            return field
        }
    var deviceLock = false //设备直接锁定
    var otaDisable = false //本地ota

    //    var deviceLockMsg: String? = ""  //设备锁定状态显示 显示内容 msg  默认显示  已锁定
    var deviceAutoLockDate: String? = null
        //设备超时自动锁定日期，20250103 -- 空或格式错误无效yyyyMMdd
        get() {
            if (null == field) return ""
            return field
        }
    var systemlog = false  //保存系统log

    var heatbeatInterval = 30 //心跳时间
    var deviceExpireDay = 0 //提前预警天数，需要在到期时间小于此值才显示过期

    //预警内存配置
    var memoryWarm = 1024
    var ramWarm = 1024
    var memoryPercWarm = 80
    var ramPercWarm = 80
    var autoRestartAt: String? = null//自动重启时间 "03:00:00"
    var autoRunApp :String?=null

    override fun toString(): String {
        return "ConfigData(installationCtrl=$installationCtrl, installationList=$installationList, appEnableCtrl=$appEnableCtrl, appEnableList=$appEnableList, deviceName=$deviceName, deviceExpire=$deviceExpire, deviceExpireMsg=$deviceExpireMsg, deviceLock=$deviceLock, deviceAutoLockDate='$deviceAutoLockDate', memoryWarm=$memoryWarm, ramWarm=$ramWarm, memoryPercWarm=$memoryPercWarm, ramPercWarm=$ramPercWarm, autoRestartAt='$autoRestartAt')"
    }

}

class Task {
    var url = ""//	是	string	升级文件路径
    var path = ""//	是	string	升级文件路径
    var md5 = ""//	否	string	升级文件md5
    var eTag = ""//	否	string	升级文件eTag
    var length = 0L//	是	int	升级文件大小
    var forced = false//	是	bool	app 是否强制安装，先卸载，再安装
    var autorun = false//	是	bool	app
    var appPackageName = ""//	是	string	安装的app包名称

    var logType = 0//	logType


    //config配置字段-----------------
    var installationCtrl = false  //开启app安装控制，开启后仅列表指定app可以安装
    var installationList: String? = null //允许安装列表
        get() {
            if (null == field) return ""
            return field
        }
    var appEnableCtrl = false  //开启app禁用控制，开启后仅列表指定app可以使用，不会禁止安装或卸载
    var appEnableList: String? = null //允许使用的app列表
        get() {
            if (null == field) return ""
            return field
        }

    var deviceName: String? = null  //配置设备名称
        get() {
            if (null == field) return ""
            return field
        }
    var deviceExpire = false  //设备预警开启
    var deviceExpireMsg: String? = null  //设备预警 显示内容 msg
    var deviceLockMsg: String? = null  //设备预警 锁定 msg
        get() {
            if (null == field) return ""
            return field
        }
    var deviceLock = false //设备直接锁定
    var otaDisable = false //本地ota

    //    var deviceLockMsg: String? = ""  //设备锁定状态显示 显示内容 msg  默认显示  已锁定
    var deviceAutoLockDate: String? = null
        //设备超时自动锁定日期，20250103 -- 空或格式错误无效yyyyMMdd
        get() {
            if (null == field) return ""
            return field
        }
    var systemlog = false  //保存系统log

    var heatbeatInterval = 30 //心跳时间
    var deviceExpireDay = 0 //提前预警天数，需要在到期时间小于此值才显示过期

    //预警内存配置
    var memoryWarm = 1024
    var ramWarm = 1024
    var memoryPercWarm = 80
    var ramPercWarm = 80
    var autoRestartAt: String? = null//自动重启时间 "03:00:00"
    var autoRunApp :String?=null

    override fun toString(): String {
        return "Task(url='$url', path='$path', md5='$md5', eTag='$eTag', length=$length, forced=$forced, autorun=$autorun, appPackageName='$appPackageName', logType=$logType, installationCtrl=$installationCtrl, appEnableCtrl=$appEnableCtrl, deviceExpire=$deviceExpire, deviceExpireMsg=$deviceExpireMsg, deviceLock=$deviceLock, otaDisable=$otaDisable, systemlog=$systemlog, heatbeatInterval=$heatbeatInterval, deviceExpireDay=$deviceExpireDay, memoryWarm=$memoryWarm, ramWarm=$ramWarm, memoryPercWarm=$memoryPercWarm, ramPercWarm=$ramPercWarm, autoRestartAt=$autoRestartAt, autoRunApp=$autoRunApp, deviceAutoLockDate=$deviceAutoLockDate, deviceLockMsg=$deviceLockMsg, deviceName=$deviceName, appEnableList=$appEnableList, installationList=$installationList)"
    }


}

class TaskData {
    var taskType = 0  //操作类型0上报状态 1 apk安装； 2 系统ota； 3 上传指定文件 4 上传系统logcat
    var taskId = 0L //task ID

    //    var logType = 0 //logType ID
    var maxLength = 10L //最大文件长度mb

    //    var url: String? = "" //task url,或文件路径等
//    var path: String? = "" //task url,或文件路径等
    var data: Task? = null

    var forced = false  //app 是否强制安装，先卸载，再安装
    var appPackageName = ""  //安装的 app包名称

    override fun toString(): String {
        return "TaskData(taskType=$taskType, taskId=$taskId, maxLength=$maxLength, data=$data, forced=$forced, appPackageName='$appPackageName')"
    }
}


/**
 * 更新人脸结果上传
 */
class FaceLoadResultBean {
    var clientID: String? = null
    var accountID: String? = null
    var result: String? = null
    var status = 0  // 1下载失败，需要重发 ，2,
    var message: String? = ""
    var updateTime: String? = null
    var models: List<FaceLoadResultBean>? = null

}